<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>example</title>
</head>

<body>
    <h1 id="container">倒计时60s</h1>
    <button id="start">启动</button>
    <button id="pause">暂停</button>
    <button id="stop">停止</button>
    <script src="../release/bundle.js"></script>
    <script>
        (function () {
            var startNode = document.getElementById('start'),
                pauseNode = document.getElementById('pause'),
                stopNode = document.getElementById('stop'),
                containerNode = document.getElementById('container'),
                timer = new Timer(1000, 60, function (params) {
                    containerNode.innerText = '倒计时' + (60 - params.cur_step) + 's';
                });
            startNode.addEventListener('click', function () {
                timer.start();
            });
            pauseNode.addEventListener('click', function () {
                timer.pause();
            });
            stopNode.addEventListener('click', function () {
                timer.stop();
            });
        })();
    </script>
</body>

</html>